package org.bambrikii.kbManager.feeds.dao;

import org.bambrikii.kbManager.feeds.model.FeedNews;
import org.bambrikii.kbManager.feeds.model.FeedSite;
import org.bambrikii.site.base.core.dao.DAOBase;
import org.bambrikii.site.base.persistence.PersistenceConnector;
import org.hibernate.Criteria;
import org.hibernate.criterion.Expression;

public class FeedNewsDAO extends DAOBase<FeedNews> implements IFeedNewsDAO {

	public FeedNewsDAO(PersistenceConnector connector) {
		super(connector);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.bambrikii.kbManager.feeds.dao.IFeedNewsDAO#getByUrl(org.bambrikii
	 * .kbManager.feeds.model.FeedSite, java.lang.String)
	 */
	@Override
	public FeedNews getByUrl(FeedSite site, String url) {
		Criteria crit = getCriteria().add(Expression.eq("site", site)).add(
				Expression.eq("url", url));
		return (FeedNews) crit.uniqueResult();
	}
}
